#!../sl -server

-- :- import "%%/lib/db.sl" #
:- import "%%/lib/client.sl" #
:- import "%%/lib/dynamic.sl" #
:- import "%%/meta/accessor.sl" #

:- structure.define (BOOK id name) #

newBook (BOOK .id .name) :-
	synchronized BOOK.NEW (
		count BOOK.ID.NEXT .id,
		insert (BOOK .id .name)
	) #

load.tables :-
	newBook (BOOK . "First Book"),
	newBook (BOOK . "The Art of Computer Programming") #

:- load.tables #

-- Do not allow exiting
:- repeat, exec "sleep 1", fail #
